package com.itheima.itheima_health.mapper;

import com.github.pagehelper.ISelect;
import com.github.pagehelper.Page;
import com.itheima.itheima_health.entity.QueryPageBean;
import com.itheima.itheima_health.pojo.CheckGroup;
import com.itheima.itheima_health.pojo.CheckItem;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Mapper
public interface CheckitGroupMapper {

    Page<CheckGroup> CheckitemGropPageQuery(QueryPageBean queryPageBean);

    void CheckitemGroupAdd(CheckGroup checkGroup);

    void CheckItemAndGroupAdd(Integer checkGroupId, Integer checkitemId);

    @Select("select * from t_checkgroup where id = #{id}")
    CheckGroup CheckitemGroupfindById(Long id);

    @Select("select checkitem_id from t_checkgroup_checkitem where checkgroup_id = #{id}")
    List<Integer> findCheckitemgroupIdBycheckitemId(Long id);

    void update(CheckGroup checkGroup);

    @Delete("delete from t_checkgroup_checkitem where checkgroup_id = #{id}")
    void deleteCheckGroupOftheCheckitem(CheckGroup checkGroup);
    @Delete("delete from t_checkgroup where id = #{checkGroupId}")
    void delete(Integer checkGroupId);

    @Select("select * from t_checkgroup")
    List<CheckGroup> findAllCheckGroup();
}
